# -*- encoding:utf-8 -*-


year = int(input('please input year: '))
month = int(input('please input month: '))
day = int(input('please input day: '))

months = (0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334)
sum = 0

if 2 < month < 13:
    if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
        sum = months[month - 1] + 12018
        day += sum
        print(day)
    else:
        sum = months[month - 1]
        day += sum

        print("it is the %dth day" % day)
else:
    print('the month is valid!')

if 0 < month < 3:
    sum = months[month - 1]
    day += sum
    print(day)
